/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package sommm;

import java.util.LinkedList;

/**
 *
 * @author root
 */
public class Dictionar {

    private LinkedList<String> lista ;

    static Dictionar instance = new Dictionar();

    private Dictionar(){
        lista = new LinkedList<String>();
    }

    public static Dictionar getInstance()
    {
        return instance;
    }
    
    public String getString(int id)
    {
        if(id>=0&&id<lista.size())
            return lista.get(id);
        return null;
    }

    public synchronized int getId(String str)
    {
   
        for(int i=0;i<lista.size();i++)
        {
            if(lista.get(i).equals(str))
                return i;
        }
        
        lista.add(str);
        return lista.size()-1;
    }

    public LinkedList<String> getLista() {
        return lista;
    }

    
}

